Skip to content

feat(openai): 支持 Responses API 与自定义兼容 /v1 探测#111

Open
wenjiazhu wants to merge 3 commits intoErlichLiu:mainfrom
wenjiazhu:main
Open

feat(openai): 支持 Responses API 与自定义兼容 /v1 探测#111
wenjiazhu wants to merge 3 commits intoErlichLiu:mainfrom
wenjiazhu:main

Conversation

@wenjiazhu
Copy link
Copy Markdown

  • 新增渠道 apiFormatchat_completions/responses),OpenAI 默认切到 responses,OpenAI 兼容默认 chat_completions
  • OpenAIAdapter 同时支持 /chat/completions/responses:构建 instructions/扁平 tools/转录文本输入,并解析 Responses SSE(meta(responseId)response.output_text.delta、工具调用事件)
  • tool loop:同一次发送内使用 previous_response_id 续接;若 Responses 流未返回 responseId 自动降级为 chat_completions 继续
  • streamSSE 聚合 responseId 并保证 done 事件只触发一次,避免重复完成信号
  • custom:连接测试与模型拉取并发探测 /models/v1/models(将 401/403 视作端点存在信号),自动回填规范化 Base URL

by wenjiazhu@gmail.com

Copy link
Copy Markdown

@JiwaniZakir JiwaniZakir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In updateChannel (channel-manager.ts), when a channel's provider is switched to openai or custom, the effectiveApiFormat falls back via input.apiFormat ?? existing.apiFormat — but existing.apiFormat was undefined for the previous non-openai provider, leaving apiFormat silently unset after the transition. The caller would need to always supply an explicit apiFormat when changing provider type, which isn't enforced anywhere visible in this diff.

The testCustomOpenAICompatible function returns resolvedBaseUrl in the ChannelTestResult, which is a useful signal, but nothing in the diff shows the test result's resolvedBaseUrl being persisted back to the channel config. If the user runs a connectivity test and /v1 gets auto-detected, the channel's stored baseUrl won't actually be updated — so subsequent requests from agent-orchestrator.ts would still use whatever the user originally typed, relying on normalizeOpenAIBaseUrl being called at runtime rather than at configuration time.

Also worth noting: the ensureV1: boolean = false parameter added to testOpenAICompatible is passed as true only for provider === 'openai', meaning providers like deepseek and moonshot still use normalizeBaseUrl instead of normalizeOpenAIBaseUrl. If those providers also serve under /v1, this inconsistency could silently affect test reliability for those channels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants